package com.project.petLossSystem.util;

import java.util.List;

public class PageResult {
    private long totalCount; // 总记录数
    private int pageSize; // 每页记录数
    private int totalPage; // 总页数
    private int currentPage; // 当前页码
    private List<?> list; // 列数据

    public PageResult(long totalCount, int pageSize, int currentPage, List<?> list) {
        this.totalCount = totalCount;
        this.pageSize = pageSize;
        this.list = list;
        this.currentPage = currentPage;
        this.totalPage = (totalCount > 0) ? (int) Math.ceil(totalCount * 1.0 / pageSize) : 1; // 总页数最少为1
    }

    public long getTotalCount() {
        return totalCount;
    }

    public void setTotalCount(int totalCount) {
        this.totalCount = totalCount;
    }

    public int getPageSize() {
        return pageSize;
    }

    public void setPageSize(int pageSize) {
        this.pageSize = pageSize;
    }

    public int getTotalPage() {
        return totalPage;
    }

    public void setTotalPage(int totalPage) {
        this.totalPage = totalPage;
    }

    public int getCurrentPage() {
        return currentPage;
    }

    public void setCurrentPage(int currentPage) {
        this.currentPage = currentPage;
    }

    public List<?> getList() {
        return list;
    }

    public void setList(List<?> list) {
        this.list = list;
    }
}
